import { DatabaseType, MySQLConfig, PostgresConfig } from './database.js';
import { LogLevel } from './logger.js';

export interface AppConfig {
  port: number;
  nodeEnv: string;
  isProd: boolean;
  jwtSecret: string;
  uploadDir: string;
  aesKey: string;
  aesIv: string;
  secretKey: string;
  secretIv: string;
  saveLogs: boolean;
  useCaptcha: boolean;
}

export interface DatabaseConfig {
  type: DatabaseType;
  mysql: MySQLConfig;
  postgres: PostgresConfig;
}

export interface RedisConfig {
  host: string;
  port: number;
  password?: string;
  db: number;
}

export interface LogConfig {
  level: LogLevel;
  dir: string;
}

export interface AuthConfig {
  whitelist: string[];
  session: {
    key: string;
    maxAge: number;
    httpOnly: boolean;
    signed: boolean;
    rolling: boolean;
  };
}

export interface RememberConfig {
  enabled: boolean;
  cookieKey: string;
  expired: number;
}

export interface SwaggerConfig {
  enabled: boolean;
  title: string;
  description: string;
  version: string;
  path: string;
  host?: string;
  basePath: string;
  schemes: string[];
}

export interface Config {
  app: AppConfig;
  db: DatabaseConfig;
  redis: RedisConfig;
  log: LogConfig;
  auth: AuthConfig;
  remember: RememberConfig;
  swagger: SwaggerConfig;
}
